<%@ page import="com.soft.health.entity.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: aug_liu
  Date: 2021/2/21
  Time: 17:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息</title>
<%--    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">--%>
<%--    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>--%>
    <link href="bootstrap/css/bootstrap.css" rel="stylesheet" >
<%--    <script src="bootstrap/js/bootstrap.js"></script>--%>

</head>
<body>
<div class="container-sm">
    <div class="row">
        <div class="span12">
            <div class="row-fluid">
                <div class="span6">
                    &nbsp;
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6">
                    <h3>
                        用户表操作
                    </h3>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6">
                    &nbsp;
                </div>
            </div>

            <form class="form-horizontal" action="userservlet" method="post">
                <input type="hidden" name="method" value="searchUser"/>
                <div class="row g-3">
                    <div class="col-sm">
                        <input id="username" name="username" type="text" class="form-control" placeholder="用户名" aria-label="用户名">
                    </div>
                    <div class="col-sm">
                        <input id="usercode" name="usercode" type="text" class="form-control" placeholder="用户Code" aria-label="用户Code">
                    </div>
                    <div class="col-sm">
                        <input id="birthday" name="birthday" type="date" class="form-control" placeholder="生日" aria-label="生日">
                    </div>
                    <div class="col-sm">
                        <button type="submit" class="btn btn-primary">查 找</button>
                    </div>
                    <div class="col-sm">
                        <a  href="#" onclick="" class="btn btn-primary">新增用户</a>
                    </div>
                </div>
            </form>

            <p class="text-warning lead">
                <label id="errormessage" name="errormessage" value="" />
            </p>

            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>
                        ID
                    </th>
                    <th>
                        用户编码
                    </th>
                    <th>
                        用户名
                    </th>
                    <th>
                        性别
                    </th>
                    <th>
                        生日
                    </th>
                    <th>
                        电话
                    </th>
                    <th>
                        地址
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                </thead>
                <tbody>
                    <%
                        List<User> userList = (List<User>)request.getAttribute("userList");
                        if (userList!=null && !userList.isEmpty()) {
                            for (User user : userList){
                    %>
                    <tr>
                        <td>
                            <%=user.getId()%>
                        </td>
                        <td>
                            <%=user.getUserName()%>
                        </td>
                        <td>
                            <%=user.getUserCode()%>
                        </td>
                        <td>
                            <%=user.getGender() == 1 ? "女" : "男"  %>
                        </td>
                        <td>
                            <%=user.getBirthday()%>
                        </td>
                        <td>
                            <%=user.getPhone()%>
                        </td>
                        <td>
                            <%=user.getAddress()%>
                        </td>
                        <td>
                            <a href="userservlet?method=userPage&id=<%=user.getId()%>" class="btn btn-outline-info">修改</a>
                            |
                            <a href="userservlet?method=updatePwdPage&id=<%=user.getId()%>" class="btn btn-outline-info">修改密码</a>
                            |
                            <a href="userservlet?method=deleteUser&id=<%=user.getId()%>" class="btn btn-outline-info">删除</a>
                        </td>
                    </tr>
                    <%
                            }
                        }
                    %>

                </tbody>
            </table>
        </div>
    </div>
</div>

<jsp:include page="footer.jsp"/>
</body>
</html>
